<?php
	

	require_once "Zend/Application.php";

	defined("APPLICATION_PATH") || define("APPLICATION_PATH", realpath(dirname(__FILE__) . "/../application"));
	defined("APPLICATION_ENV") || define("APPLICATION_ENV", (getenv("APPLICATION_ENV") ? getenv("APPLICATION_ENV") : "production"));

	$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . "/configs/application.ini");
	$controller = Zend_Controller_Front::getInstance();
	$controller->setParam("noViewRenderer", true);

	Zend_Session::start();

	$resource = $application->getBootstrap()->getPluginResource("multidb");
	$resource->init();
	$readerDb = $resource->getDb("reader");
	$writerDb = $resource->getDb("writer");
	Zend_Registry::set("READER_DB", $readerDb);
	Zend_Registry::set("WRITER_DB", $writerDb);
	
	$smarty = new BMSC_Smarty(APPLICATION_PATH . "/../templates");
	Zend_Registry::set("SMARTY", $smarty);

	$application->bootstrap()->run();
?>